//
//  TTPopoverView.swift
//  TTCOM-macOS
//
//  Created by Toj on 5/8/21.
//

import Cocoa

class TTPopoverView: NSView {

    override func viewDidMoveToWindow() {
        guard let view = window?.contentView?.superview else { return }
        let x: CGFloat = 13
        let height: CGFloat = 13
        let width: CGFloat = view.bounds.size.width - 13 * 2
        let y = view.bounds.size.height - 13
        
        let bgView  = NSView()
        bgView.frame = CGRect(x: x, y: y, width: width, height: height)
        
        bgView.wantsLayer = true
        bgView.layer?.backgroundColor = window?.contentView?.layer?.backgroundColor
        
        bgView.autoresizingMask = [.width, .height]
        view.addSubview(bgView, positioned: .below, relativeTo: view)
        
        super.viewDidMoveToWindow()
    }
}
